package com.devops.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devops.admin.model.DOSRelease;
import com.devops.admin.po.DOSReleasePo;
import com.devops.admin.vo.DOSNamespaceChart;
import com.devops.admin.vo.DOSReleaseVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;

/**
 * @ClassNem DOSReleaseMapper
 * @Description TODO
 * @Author heyabo
 * @Date 2022/3/22 14:47
 * @Version 1.0
 **/
@Mapper
public interface DOSReleaseMapper extends BaseMapper<DOSRelease> {

    /**
     * @Author heyabo
     * @Description 分页查询release
     * @Date 14:37 2022/3/24
     * @Param [page, releaseVo]
     * @return java.util.List<com.devops.admin.po.DOSReleasePo>
     **/
    List<DOSReleasePo> selectReleasePage(Page<DOSReleasePo> page,@Param("param") DOSReleaseVo releaseVo);

    /**
     * @Author heyabo
     * @Description 查询release
     * @Date 14:37 2022/3/24
     * @Param [page, releaseVo]
     * @return java.util.List<com.devops.admin.po.DOSReleasePo>
     **/
    List<DOSReleasePo> selectReleasePage(@Param("param") DOSReleaseVo releaseVo);

    /**
     * @Author heyabo
     * @Description 根据名称获取命名空间和chart
     * @Date 17:37 2022/4/27
     * @Param [releaseId]
     * @return com.devops.admin.vm.DOSNamespaceChart
     **/
    DOSNamespaceChart getInfoById(int releaseId);

    /**
     * @Author heyabo
     * @Description 根据项目id和环境类型查询release
     * @Date 09:25 2022/7/5
     * @Param [releaseVo]
     * @return java.util.List<com.devops.admin.po.DOSReleasePo>
     **/
    List<DOSReleasePo> selectReleaseListByProjectIdAndEnvType(@Param("param") DOSReleaseVo releaseVo);

    DOSReleasePo getReleaseDetailById(Integer releaseId);

    /**
     * @Author heyabo
     * @Description 根据项目分组查询release的数量
     * @Date 10:42 2022/8/26
     * @Param []
     * @return java.util.List<com.devops.admin.po.DOSReleaseCountPo>
     **/
    List<HashMap<String,Object>> getGroupRelease();

    /**
     * @Author heyabo
     * @Description 查询普通的用户能看到的release列表
     * @Date 14:25 2022/9/8
     * @Param [releaseVo]
     * @return java.util.List<com.devops.admin.po.DOSReleasePo>
     **/
    List<DOSReleasePo> getReleasePageForGeneralUser(Page<DOSReleasePo> page,@Param("param")DOSReleaseVo releaseVo);

    /**
     * @Author heyabo
     * @Description 根据项目id获取release
     * @Date 13:41 2022/9/9
     * @Param [projectId]
     * @return java.util.List<com.devops.admin.po.DOSReleasePo>
     **/
    List<DOSReleasePo> getReleaseByProjectId(Integer projectId);

    /**
     * 获取是否在库里有相似度较高的release存在
     * @return
     */
    List<String> getReleaseNameSimilarity(String releaseName,Double similarityLimit);
}
